'########################################################################### '# # '# W P X CALLSIGN SORTING ROUTINE # '# by # '# Bj. Madsen -+- VE5FX # '# Jan. 1987 # '# # '########################################################################### ' ' This program will read a previously-created file of callsigns from disk to ' memory. It will then sort them into CQ Magazines required order using ' letters smaller than numbers, and a 0 larger than a 9. Once a file has ' been sorted, it is written out again under the same or different name. ' CLEAR ,10000 CLEAR ,50000 DIM CS$(3000) CLS : N=1 LINE (0,0)-(640,5),3,BF LINE (0,0)-(10,200),3,BF LINE (607,0)-(617,200),3,BF LINE (0,181)-(617,186),3,BF LINE (0,30)-(640,35),3,b PAINT (20,10),2,3:PAINT (20,33),1,3 COLOR 3,2 LOCATE 3,20:PRINT "V E 5 F X - Callfile Sort Program" COLOR 3,0 LOCATE 10,15 :INPUT"What file do you want to READ FROM";INFILE$ LINE (50,45)-(570,57),3,BF LOCATE 7,13 :COLOR 0,3:PRINT"INFILE: ";INFILE$ GOSUB CLEARIT LOCATE 10,15 :COLOR 3,0 :INPUT"What file do you wish to WRITE TO..";OUTFILE$ LOCATE 7,53 :COLOR 0,3:PRINT "OUTFILE: ";OUTFILE$ OPEN "I",#1,INFILE$ WHILE NOT EOF(1) INPUT #1,CS$(N) LET N = N + 1 WEND LET N = N - 1 CLOSE : COLOR 1,3 ' LOCATE 7,34 :COLOR 1,3 :PRINT N;"calls" ANOTHER: GOSUB CLEARIT LOCATE 10,15 :COLOR 3,0 :INPUT"Do you wish to read another input file";a$ IF LEFT$(a$,1) <> "Y" THEN CONVERTIT INPUT"What is the filespec of this file";INFILE$ OPEN"I",#1,INFILE$ WHILE NOT EOF(1) INPUT #1,CS$(N) LET N = N + 1 WEND LET N = N - 1 CLOSE LOCATE 7,32 :COLOR 1,3 :PRINT N;"calls" GOTO ANOTHER ' ----------------------------------------- convert callsigns pre-sort CONVERTIT: LOCATE 12,23:COLOR 2,0:PRINT "start converting @ ";TIME$ GOSUB CLEARIT:LOCATE 10,15:COLOR 3,0:PRINT "Converting callsigns...." FOR X = 1 TO N FOR I = 1 TO LEN(CS$(X)) V = ASC(MID$(CS$(X),I,1)) IF V>47 AND V<58 THEN IF V=48 THEN V=106 :ELSE V=V+48 MID$(CS$(X),I,1) = CHR$(V) NEXT I NEXT X ' ----------------------------------------- sort callsigns into WPX format LOCATE 13,23:COLOR 2,0:PRINT "start sorting @ ";TIME$ SORTIT: P=P+1 GOSUB CLEARIT:LOCATE 10,15:COLOR 3,0:PRINT "Sorting callsigns....pass #";P FLAG = 0 FOR X = 1 TO N-1 IF CS$(X) > CS$(X+1) THEN SWAP CS$(X),CS$(X+1) : FLAG = 1 NEXT X IF FLAG <> 0 THEN SORTIT '----------------------------------------- restore calls to standard format RESTOREIT: LOCATE 14,23:COLOR 2,0:PRINT "Start restoring @ ";TIME$ GOSUB CLEARIT: LOCATE 10,15:COLOR 3,0:PRINT "Restoring callsign format ......." FOR X = 1 TO N FOR I = 1 TO LEN(CS$(X)) V=ASC(MID$(CS$(X),I,1)) IF V>96 THEN IF V=106 THEN V=48 :ELSE V=V-48 MID$(CS$(X),I,1) = CHR$(V) NEXT I NEXT X '----------------------------------------------- write sorted file to disk GOSUB CLEARIT LOCATE 10,15: COLOR 3,0 :PRINT "Writing ";OUTFILE$;" to disk ......" OPEN OUTFILE$ FOR OUTPUT AS #1 FOR X = 1 TO N PRINT #1,CS$(X) NEXT X CLOSE #1 GOSUB CLEARIT LOCATE 10,15 :COLOR 3,0 :PRINT "Output file has been created with";N;"calls." END CLEARIT: COLOR 0,0:LOCATE 10,15:PRINT STRING$(60," ") RETURN